defmodule SnowIdLib do
	@moduledoc false

	def next!() do
		case Snowflake.next_id() do
			{:ok, id} ->
				Integer.to_string(id)
			{_, _reason} ->
				raise TipError, "unexpected_error"
		end
	end

	def get_string!() do
		get_int!()
		|> Integer.to_string()
	end

	def get_int!() do
		case Snowflake.next_id() do
			{:ok, id} ->
				id
			{_, _reason} ->
				raise TipError, "unexpected_error"
		end
	end

	def set_env() do
		Enum.each(AppConfigure.fetch(:snowflake), &Application.put_env(:snowflake, elem(&1, 0), elem(&1, 1)))
	end

end
